from classification import *
from datatreat import *

# 读入数据
bbc_df = pd.read_csv('./dataset/dataset.csv', encoding='ISO-8859-1')
X_train, X_test, y_train, y_test = devide(bbc_df)
X_train_tfidf, X_test_tfidf, y_train, y_test = TFIDF(X_train, X_test, y_train, y_test)


if __name__ == '__main__':
	print('=======================================================\n\
		       BBC  TEST\
			\n=======================================================')
	nb(X_train_tfidf, X_test_tfidf, y_train, y_test)
	dt(X_train_tfidf, X_test_tfidf, y_train, y_test)
	svm(X_train_tfidf, X_test_tfidf, y_train, y_test)
	mlp(X_train_tfidf, X_test_tfidf, y_train, y_test)
	bg(X_train_tfidf, X_test_tfidf, y_train, y_test)
	rf(X_train_tfidf, X_test_tfidf, y_train, y_test)

	'''
	分类报告模板

							classification_report
						准确率 		召回率		F1值
					precision		recall		f1-score	support
	
				0		0.85		0.79		0.81		14
				1		0.91		0.91		0.91		22
				2		0.91		0.97		0.94		33
				3		1.00		0.79		0.88		19
				4		0.80		1.00		0.89		12

		accuracy					0.90		100						准确度
   		macro avg		0.89		0.89		0.89		100			宏平均
	weighted avg		0.91		0.90		0.90		100			加权平均
	'''